home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / MacApp Documentation / MacApp.TECH$ Archives / 1990 / Dec 90 / MacApp.Tech$ 12⁄14⁄90 / 2487-Re C++ demodialogs b-Dec90 < prev    next >
Encoding:
Text File  |  1991-03-06  |  2.0 KB  |  69 lines  |  [TEXT/GEOL]

  1. Item    0738771                         11-Dec-90        00:54PST
  2.  
  3. From:   ARROUYE                         R&D Software Engineer
  4.  
  5. To:     MUYSVASOVIC                     ACE - Jean-Denis Muys-Vasovic
  6.         MACDTS                          Macintosh Developer Tech Supt
  7.         MOOF                            Rollin, Keith A
  8.         APPLE.BUGS                      Apple Bugs Reporting
  9.         MACAPP.TEST                     MacApp SQA Team
  10.  
  11. cc:     MACAPP.TECH$                    MacApp Technical
  12.  
  13. ------------------------------------------------------------------------------
  14.  
  15. Sub:    Re: C++ demodialogs bugs     
  16.  
  17. Enclosure: CPlusMacApp.PKG
  18.  
  19. Jean-Denis,
  20.  
  21. Using the (i) command of the Macapp debugger generally prints garbage anyway.
  22. The reason is that the Pascal convention for passing the static link is: push
  23. it only if not zero. For some reason it seems that the static link is always
  24. valid when Fields() is called from the inspector, while it is not when Fields()
  25. is called from the debugger.
  26.  
  27. A solution to this problem was proposed by Robert Lenoil (LENOIL) on
  28. Macapp.Tech$ in a unit called CPlusMacApp.
  29.  
  30. I encourage everybody to use this unit that provides correct asm glue code and
  31. C++ macros to write fields methods that work in any context. The same unit also
  32. provides a failure handler class which lets you write exception handling code
  33. IN the function scope (so you have access to all the variables). Here are a few
  34. extra macros to make exception handling with CPlusMacapp even easier:
  35.  
  36.  #define TRY   {   \
  37.    TFailureHandler __fh__; \
  38.    if (__fh__.Install() == proceed) {
  39.  
  40. #defineEXCEPTION   } else  {
  41.  
  42.  
  43. #defineENDTRY  }   \
  44.    }
  45.  
  46. #define ERROR __fh__.GetError()
  47.  
  48. #define MESSAGE __fh__.GetMessage()
  49.  
  50. #define RERAISE __fh__.PassException()
  51.  
  52.  
  53.  
  54. Failure handling code with then look like that:
  55.  
  56. {
  57.     …
  58.     TRY
  59.         // Be brave: try to do it!
  60.         ActionThatMightFail();
  61.  
  62.     EXCEPTION
  63.         // We caught an exception
  64.         CodeToRecoverFrom(ERROR);
  65.  
  66.     ENDTRY
  67.     …
  68. }
  69.